{% load hash_filters %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Adult Services Distribution Admin</title>
  <!-- YUI Components --> 
  <link rel="stylesheet" href="/css/default/element.css" type="text/css" media="all" charset="utf-8"/>
  <link rel="stylesheet" href="/css/default/dialog.css" type="text/css" media="all" charset="utf-8"/>
  <link rel="stylesheet" href="/css/default/general.css" type="text/css" media="all" charset="utf-8"/>
  <link rel="stylesheet" href="/css/default/service.css" type="text/css" media="all" charset="utf-8"/>
  <script type="text/javascript" charset="utf-8"
          src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js">
  </script>
  <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
  <script type="text/javascript" src="/js/mesh.js"></script>
  <script type="text/javascript" src="/js/ui.js"></script>
  <script type="text/javascript" src="/js/dialog.js"></script>
  <script type="text/javascript" src="/js/admin.js"></script>
  <script type="text/javascript" src="/js/ele.js"></script>
  <script type="text/javascript">
    function InitZoyoe(){
      var zoom = 15;
      var center = null;
      if({{LOC.x}} != 0 && {{LOC.y}} != 0){
        center = new Microsoft.Maps.Location({{LOC.x}},{{LOC.y}});
      }else{
        zoom = 11;
      }
      zoyoe.admin = InitAdmin(zoyoe);
      zoyoe.service_name = '{{SERVICE.name}}';
      var theMap = new MapInfoCore(function(rmap){
         sdist(rmap);
      },center,"map-info",zoom,true)
      zoyoe.map = theMap;
      zoyoe.InitZoyoe();
    }
    function sdist(ret_map){
      YUI().use('io-form',function(IO){
        var uri = ("/core/data/getservices/?tstmp={{TIME_STAMP}}");
        zoyoe.map = ret_map;
        function complete(io,o,args){
          var s_element = o.responseXML.documentElement.getElementsByTagName('SERVICE');
          for(var i=0;i<s_element.length;i++){
            var element = s_element[i];
            var service = new Service(element);
            ret_map.AddService(service);
          }
          ret_map.ShiftZoom(true);
        }
        IO.on('io:complete',complete);
        var request = IO.io(uri);
      });
    }
  </script>
 </head>
 <body onload="InitZoyoe()" >
  <div class='page'>
    <div id='title-bar'>
      <div class='nav'>
        <ul>
          <li class='menu'><a href='/search/'>Home</a></li>
          {% if SESSION.login_id %}
          <li class='menu' onclick ="Logout()"><a>Logout</a></li>
          {% else %}
          <li class='menu' onclick ="zoyoe.ui.ShowLoginDialog()"><a>Login</a></li>
          <li class='menu' onclick ="zoyoe.ui.ShowRegisterDialog()"><a>Register</a></li>
          {% endif %}
          <li class='menu' onclick ="zoyoe.ui.ShowAddServiceDialog()"><a>Publish</a></li>
        </ul>
        <div class='title'>
          <a href="/search/"><img src="/res/map_logo_5.png" width="236px" height="40px"/></a>
        </div>
      </div>
    </div>
    <div class='mid-section'
      style="width:900px;margin:auto;float:none;">
      <div class='section-container'>
        <div class='section'
        style="height:250px;margin:auto;float:none;">
          <div id="map-info" style="z-index:10;position:absolute;margin:auto;
            height:250px;width:865px;">
          </div>
          <div style="z-index:11;position:absolute;opacity:0;background-color:white;width:865px;height:250px;">
          </div>
          <a style="z-index:12;position:relative;display:block;text-decoration:none;
                      opacity:0.3;width:865px;height:40px;top:110px;padding-top:5px;
                      -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=30)';
             text-align:center;font-size:30px;font-weight:bold;color:white;background-color:blue;"
             href="/map/" >SHOW ALL SERVICES ON MAP</a>
        </div>
      </div>
    </div>
    <div id="mid-section" class='mid-section' style="clear:both;width:900px;margin:auto;float:none;">
      <div class='section-container'>
        <div id = 'list' class='section'>
          <div class="info-block">
            <ul class="border-split">
              {% for service in DATA%}
              <li style="clear:both;padding:5px">
                <img src='/core/data/res/{{service.name}}/{{service.icon}}/?sc=true' 
                  style='width:80px;height:80px;float:left;padding: 0 10px 5px 0px'></img>
                <div>
                <p><span style="text-transform:uppercase">
                    <a style="color:white;" href="/core/service/{{service.name}}/">{{service.name}}</a></span>
                   <span>({{service.type}}:</span><span>grade:{{service.grade}})</span>
                   <span>privilege:{{service.privilege}}</span> - <span>phone:{{service.phone}}</span>
                   <!--
                   <a>
                   <span class='button' onclick="zoyoe.admin.DeleteService('{{service.name}}')">delete</span>
                   <span class='button' onclick="zoyoe.admin.ResetService('{{service.name}}')">reset</span></a>
                   !-->
                </p>
                <p><span>Email:{{service.email}}</span>
                   <span>Address:{{service.address}}</span>
                   <span>Distance:{{DIS|hash:service.name}}
                </p>
                </div>
              </li>
              {% endfor %}
            </ul>
          </div>
        </div>
      </div>
    </div>
  </div><!-- page -->
  <div id='zsk' class='msk'>
  </div>
  <div id='dialog'>
   <div class='dialog'>
    <div class='dialog-hint'>
    </div>
    <div class='dialog-content'>
    </div>
    <div class='button-lane'>
      <input type='button' value='ok' onclick='zoyoe.ui.SubmitForm();'></input>
      <input type='button' value='cancel' onclick='zoyoe.ui.HideDialog();'></input>
    </div>
   </div>
  </div>
</body>
</html>

